<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="paging" uri="paging-taglib" %>
<%--
  Created by IntelliJ IDEA.
  User: LV
  Date: 2016/6/30
  Time: 15:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>全部商品列表</title>
    <script>
        $(function () {
            //填充商店分类下拉选
            $.getJSON("${ctx}/shop/getShopCategoryList", function(json){
                //alert("JSON Data: " +json);
                //alert(json.length);
                for(var i in json){
                    //alert(json[i].areaName);
                    $("#shop_category").append("<option value='"+json[i].categoryId+"'>"+json[i].categoryName+"</option>");
                }
            });
        });
    </script>

</head>
<body>
<div class="navigation">
    <div class="crumbs ">
        <i class="tm-iconfont icon-info"></i>
        <a href="//mai.taobao.com/seller_admin.htm">卖家中心</a><span>&gt;</span><a href="#200">商品管理</a><span>&gt;</span>商品列表
    </div>
    <div class="help">
        <a href="#" target="_blank">卖家交易学习专区</a>
    </div>
</div>
<!--商品列表 star-->
<div class="goods_list p-t10">

    <form action="${ctx}/product/searchProductByConditions" method="post">
        <div class="tip_from p-l20">
            <ul>
                <li><label>商品名称：</label><input type="text" class="text w150" name="pName"/></li>
                <li><label>商品编码：</label><input type="text" class="text w150" name="pCode"/></li>
                <li><label>店铺分类：</label>
                    <select class="text w172" name="pCategory" id="shop_category">
                        <option value="">全部</option>
                    </select>
                </li>
                <li></li>
            </ul>
            <div class="bot p-tb20"><label>&nbsp;</label><button class="i_btn u2">搜索商品</button></div>
        </div>
    </form>

    <div class="mtc_tab">
        <!--star mt-->
        <div class="mt">
            <a href="${ctx}/product/productListAll" class="curr">全部商品商品</a>
            <a href="${ctx}/product/productList?status=1" >销售中的商品</a>
            <a  href="${ctx}/product/productList?status=0">已下架的商品</a>
        </div>
        <!--end mt-->
        <!--star mc-->
        <div class="mc">
            <div class="u_table_list line-all m-t20">
                <table>
                    <colgroup>
                        <col width="35%">
                        <col width="10%">
                        <col width="8%">
                        <col width="10%">
                        <col width="13%">
                        <col width="10%">
                        <col width="15%">
                    </colgroup>
                    <tr class="line-bottom fwb">
                        <th>商品名称</th>
                        <th>单价（元）</th>
                        <th>库存</th>
                        <th>总销量</th>
                        <th>发布时间</th>
                        <th>店长推荐</th>
                        <th>&nbsp;</th>
                    </tr>
                    <c:forEach items="${productList}" var="list" >
                        <tr>
                            <td>
                                <div class="product_name">
                                    <div class="t_img"><img src="${list.productMainImage}" /></div>
                                    <div class="t_info">
                                        <a href="#">${list.productName}</a>
                                        <div>
                                            <span class="c-999999">商品编码：${list.productCode}</span>
                                            <c:if test="${list.status==1}">
                                            <span class="c-FF0000 r">销售中</span>
                                            </c:if>
                                            <c:if test="${list.status==0}">
                                            <span class="c-FF0000 r">已下架</span>
                                            </c:if>
                                        </div>
                                    </div>
                                </div>
                            </td>
                            <td>${list.salePrice}</td>
                            <td>${list.inventoryNum}</td>
                            <td><span class="c-3b9eeb">${list.saleCountTotal}</span></td>
                            <td><fmt:formatDate value="${list.createOn}" pattern="yyyy-MM-dd HH:mm"/></td>
                            <td>
                                <c:if test="${list.isShopRecommend==1}">
                                    <div><a class="c-FF0000" href="#">推荐展示中</a></div>
                                    <div><a class="c-3b9eeb" href="${ctx}/product/updateProductRecommendStatus?pId=${list.productId}&status=0">取消推荐</a></div>
                                </c:if>
                                <c:if test="${list.isShopRecommend==0}">
                                    <div><a class="c-FF0000" href="#">未推荐</a></div>
                                    <div><a class="c-3b9eeb" href="${ctx}/product/updateProductRecommendStatus?pId=${list.productId}&status=1">设为店铺推荐</a></div>
                                </c:if>
                            </td>
                            <td><a class="c-FF0000 m-r10" href="${ctx}/product/editProduct?pId=${list.productId}">编辑商品</a>
                                <c:if test="${list.status==1}">
                                <a class="c-3b9eeb" href="${ctx}/product/updateProductStatus?pId=${list.productId}&status=0">下架</a>
                                </c:if>
                                <c:if test="${list.status==0}">
                                <a class="c-3b9eeb" href="${ctx}/product/updateProductStatus?pId=${list.productId}&status=1">上架</a>
                                </c:if>
                            </td>
                        </tr>
                    </c:forEach>
                </table>
            </div>
            <div class="pages" style="padding:20px; text-align:right;">
                <ul>
                    <paging:paging pageIndex="${pageIndex}" totalPage="${totalPage}" href="${ctx}/product/productListAll"  htmlTag="li"></paging:paging>
                    <%--<li><a>上一页</a></li>--%>
                    <%--<li><a>1</a></li>--%>
                    <%--<li class="active"><a>2</a></li>--%>
                    <%--<li><a>3</a></li>--%>
                    <%--<li><a>4</a></li>--%>
                    <%--<li>...</li>--%>
                    <%--<li><a>100</a></li>--%>
                    <%--<li><a>下一页</a></li>--%>
                </ul>
                <%--<form>--%>
                <%--共100页到第--%>
                <%--<input type="text" value="1" class="inputwh">--%>
                <%--页--%>
                <%--</form>--%>
            </div>

        </div>
        <!--end mc-->
    </div>
</div>
<!--商品列表 end -->
</body>
</html>
